﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DisplayBoardInfo.Server.Forms.Administrator
{
    public partial class VoiceSettings : Form
    {
        public VoiceSettings()
        {
            InitializeComponent();
        }

        private void VoiceSettings_Load(object sender, EventArgs e)
        {
            voiceOn.Checked = Properties.Settings.Default.VoiceOn;
            pathTextBox.Text = Properties.Settings.Default.IVONAPath;
            voiceGroup.Enabled = voiceOn.Checked;
        }

        private void voiceOn_CheckedChanged(object sender, EventArgs e)
        {
            voiceGroup.Enabled = voiceOn.Checked;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.VoiceOn = voiceOn.Checked;
            Properties.Settings.Default.IVONAPath = pathTextBox.Text;
            Properties.Settings.Default.Save();
            Helpers.Voice.RefreshSettings();
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void testButton_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.VoiceOn = voiceOn.Checked;
            Properties.Settings.Default.IVONAPath = pathTextBox.Text;
            Properties.Settings.Default.Save();

            Helpers.Voice.RefreshSettings();

            Helpers.Voice.Read("Gratuluję, test zakończony pomyślnie");
        }

        private void browseButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Aplikacja IVONA Reader|*.exe";
            openFileDialog1.Title = "Wybierz ściężkę do aplikacji IVONA Reader";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                pathTextBox.Text = openFileDialog1.FileName;
            }
        }
    }
}
